import java.sql.SQLOutput;

class Student {
    private String name = "lcc";
    //公有属性age
    public int age = 18;
    //不带参数的构造方法
    public Student(){
        System.out.println("Student()");
    }
    private Student(String name,int age) {
        this.name = name;
        this.age = age;
        System.out.println("Student(String,name)");
    }
    private void eat(){
        System.out.println("i am eat");
    }
    public void sleep(){
        System.out.println("i am pig");
    }
    private void function(String str) {
        System.out.println(str);
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

}

public class Test {
    public static void main(String[] args) throws ClassNotFoundException{
        Student student = new Student();
        Class<?> c1 = student.getClass();//或者Class对象
        Class<?> c2 = Student.class;
        Class<?> c3 = Class.forName("Student");//括号里面放类的路径
        //一个类在JVM中只有一个Class实例，所以上面获取到的Class对象都指向同一个对象
        System.out.println(c1 == c2);//对象通过双等号来判断其地址是否相同
        System.out.println(c1 == c3);
        System.out.println(c2 == c3);

    }
}
